import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *

from ui.Ui_my_MainWindow import Ui_MainWindow
from ui.Ui_my_Diolog import Ui_Dialog

class Dialog(QDialog):
    
    def __init__(self):
        super().__init__()
        
        self.ui = Ui_Dialog() 
        #加载ui对象
        self.ui.setupUi(self)

        self.init_ui()
        
    def init_ui(self):
        pass

class MainWindow(QMainWindow):
    
    def __init__(self):
        super().__init__()
        
        self.ui = Ui_MainWindow()
        #加载ui对象
        self.ui.setupUi(self)

        self.init_ui()
    
    def on_btn_clicked(self):
        self.ui.label.setText("你好")
        self.statusBar().showMessage("hello")
        
        diolog = Dialog()
        rst = diolog.exec_()
        print("rst:",rst)
        
        
        
    def init_ui(self):
        self.ui.pushButton.clicked.connect(self.on_btn_clicked)
        

if __name__ == '__main__':
    app = QApplication(sys.argv)
    widget = MainWindow()
    widget.show()
    sys.exit(app.exec_())
